{% extends "base.html" %}
{% block page_title %}Password Reset{% endblock %}

{% load account %}

{% block content %}
<div class="row">
  <div class="col-md-6 col-md-offset-3">
    <div class="card">
      <div class="cardface">
        <h2>{% if token_fail %}Bad Token{% else %}Change Password{% endif %}</h2>
        {% if token_fail %}
          {% url 'account_reset_password' as passwd_reset_url %}
          <p>
            The password reset link was invalid, possibly because it has already been used.
            Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.
          </p>
        {% else %}
          {% if form %}
            <form method="POST" action="{{ action_url }}">
              {% csrf_token %}
              <div class="form-group">
                <label class="control-label" for="{{ form.password1.id_for_label }}">{{ form.password1.label }}</label>
                <input class="form-control" id="{{ form.password1.id_for_label }}" maxlength="30" name="{{ form.password1.html_name }}" type="password" placeholder="{{ form.password1.label }}"/>
                {{ form.password1.errors }}
              </div>
              <div class="form-group">
                <label class="control-label" for="{{ form.password2.id_for_label }}">{{ form.password2.label }}</label>
                <input class="form-control" id="{{ form.password2.id_for_label }}" maxlength="30" name="{{ form.password2.html_name }}" type="password" placeholder="{{ form.password2.label }}"/>
                {{ form.password2.errors }}
              </div>
              <div class="form-group">
                <button class="btn btn-primary" type="submit">Sign In</button>
                <input type="hidden" name="next" value="{{ next }}" />
              </div>
            </form>
          {% else %}
            <p>Your password is now changed.</p>
          {% endif %}
        {% endif %}
      </div>
    </div>
  </div>
</div>
{% endblock %}
